home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / answrbok / 7_10.lha / 7_10 / p_shuffle.c < prev    next >
Text File  |  1993-08-08  |  844b  |  28 lines

  1. * Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */
  2. * The C++ Answer Book */
  3. * Tony Hansen */
  4. * All rights reserved. */
  5. include <process.h>
  6. include <debug.h>    /* DELETE */
  7. / Move the top process on the run list down to its
  8. / proper place as ordered by time and priority
  9. oid process::shufflerunlist()
  10.  
  11.    if (debug) /*DELETE*/ cerr << "process" << this << "::shufflerunlist()\n";
  12.    for (process **pp = &t_runprocesses;
  13.  (*pp)->t_next &&
  14.  (((*pp)->t_desiredtime > (*pp)->t_next->t_desiredtime) ||
  15.   (((*pp)->t_desiredtime == (*pp)->t_next->t_desiredtime) &&
  16.    ((*pp)->t_priority > (*pp)->t_next->t_priority)));
  17.  )
  18. {
  19. process *sv = *pp;
  20. process *svn = sv->t_next;
  21. *pp = svn;
  22. sv->t_next = svn->t_next;
  23. svn->t_next = sv;
  24. pp = &svn->t_next;
  25. }
  26.    if (debug) /*DELETE*/ cerr << "<<<< process" << this << "::shufflerunlist()\n";
  27.  
  28.